package leetcode.code0836;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

public class Solution implements IDebug {

	public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
		int x1 = Math.max(rec1[0], rec2[0]);
		int x2 = Math.min(rec1[2], rec2[2]);
		if (x1 >= x2) {
			return false;
		}
		int y1 = Math.max(rec1[1], rec2[1]);
		int y2 = Math.min(rec1[3], rec2[3]);
		if (y1 >= y2) {
			return false;
		}
		return true;
	}

	@Override
	public void debug4() {
		HelpDebug.compare(false, this.isRectangleOverlap(HelpDebug.str2array3("[0,0,1,1]"), HelpDebug.str2array3("[1,0,2,1]")));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
